import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PlatformIncomeVO, PlatformIncomeForm, PlatformIncomeQuery } from '@/api/business/platformIncome/types';

/**
 * 查询平台收入记录列表
 * @param query
 * @returns {*}
 */

export const listPlatformIncome = (query?: PlatformIncomeQuery): AxiosPromise<PlatformIncomeVO[]> => {
  return request({
    url: '/business/platformIncome/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询平台收入记录详细
 * @param id
 */
export const getPlatformIncome = (id: string | number): AxiosPromise<PlatformIncomeVO> => {
  return request({
    url: '/business/platformIncome/' + id,
    method: 'get'
  });
};

/**
 * 新增平台收入记录
 * @param data
 */
export const addPlatformIncome = (data: PlatformIncomeForm) => {
  return request({
    url: '/business/platformIncome',
    method: 'post',
    data: data
  });
};

/**
 * 修改平台收入记录
 * @param data
 */
export const updatePlatformIncome = (data: PlatformIncomeForm) => {
  return request({
    url: '/business/platformIncome',
    method: 'put',
    data: data
  });
};

/**
 * 删除平台收入记录
 * @param id
 */
export const delPlatformIncome = (id: string | number | Array<string | number>) => {
  return request({
    url: '/business/platformIncome/' + id,
    method: 'delete'
  });
};
